home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 12 / CU Amiga Magazine's Super CD-ROM 12 (1997)(EMAP Images)(GB)[!][issue 1997-07].iso / CUCD / Games / DestructivePoker / sources / sources.lha / POKER.CPP < prev    next >
C/C++ Source or Header  |  1997-02-13  |  3KB  |  128 lines

  1. /*
  2.         poker.cpp       (windows pääohjelma moduuli)
  3.  
  4.         V1.00 - 031196  Kimmo Teräväinen
  5.         -----   ------  ----------------
  6.         V0.01   031196  Taken laskuri.cpp by Vesa Lappalaine and edited
  7.         V0.10   291196  it a lot.
  8.  
  9. PROJECT: (Windows)
  10.  
  11.         POKER.CPP
  12.  
  13.         POKER.RC
  14.     GAME.CPP
  15.     IMAGE.CPP
  16.     CARD.CPP
  17.     CARDPILE.CPP
  18.     HANDPILE.CPP
  19.     HANDPRFS.CPP
  20.     DEALPILE.CPP
  21.     BETPREFS.CPP
  22.     DOUBLE.CPP
  23.     SAVEFILE.CPP
  24.  
  25.  
  26. */
  27.  
  28. #include <owl/owlpch.h>
  29. #include <owl/profile.h>
  30.  
  31. #include "poker.rh"
  32. #include "game.h"
  33.  
  34. #define INIFILE "poker.ini"
  35.  
  36. //---------------------------------------------------------------------------
  37. class TPokerDialog : public TDialog {
  38.   cGamePoker *game;
  39.   TBitmap *cardgfx;
  40. public:
  41.   TPokerDialog(TWindow *parent, TResId resId, TModule *module = 0) :
  42.     TDialog(parent,resId,module)
  43.   {}
  44.   void SetupWindow() {
  45.     const TModule &module(*this->GetModule());
  46.     cardgfx=new TBitmap(module,CARDGFX);
  47.     game=new cGamePoker(this,cardgfx);
  48.     // this->CreateChildren();
  49.   }
  50.   virtual ~TPokerDialog()  {
  51.     if(game) delete game; game=NULL;
  52.     if(cardgfx) delete cardgfx; cardgfx=NULL;
  53.   }
  54.   void CmMenuQuit() {
  55.     Destroy();
  56.   }
  57.  
  58.   void CmMenuNew()   { game->MenuNew();   }
  59.   void CmMenuOld()   { game->MenuOld();   }
  60.   void CmMenuSave()  { game->MenuSave();  }
  61.   void CmMenuAbout() { game->MenuAbout(); }
  62.  
  63. //  void CmMenuEditCopy() { game->MenuCopy(); }
  64.  
  65.   void CmMenuPrefsBet()  { game->MenuPrefsBet();  }
  66.   void CmMenuPrefsHand() { game->MenuPrefsHand(); }
  67.  
  68.   void CmMenuHelp() { game->MenuHelp(); }
  69.  
  70.   void BnCard0() { game->GadgetTurn(0); }
  71.   void BnCard1() { game->GadgetTurn(1); }
  72.   void BnCard2() { game->GadgetTurn(2); }
  73.   void BnCard3() { game->GadgetTurn(3); }
  74.   void BnCard4() { game->GadgetTurn(4); }
  75.  
  76.   void BnBet()     { game->GadgetBet();     }
  77.   void BnShuffle() { game->GadgetShuffle(); }
  78.   void BnFinish()  { game->GadgetFinish();  }
  79.  
  80.   DECLARE_RESPONSE_TABLE(TPokerDialog);
  81. };
  82.  
  83. DEFINE_RESPONSE_TABLE1(TPokerDialog, TDialog)
  84.   EV_BN_CLICKED(BUTTON_BET,BnBet),
  85.   EV_BN_CLICKED(BUTTON_SHUFFLE, BnShuffle),
  86.   EV_BN_CLICKED(BUTTON_FINISH, BnFinish),
  87.   EV_BN_CLICKED(BUTTON_CARD0, BnCard0),
  88.   EV_BN_CLICKED(BUTTON_CARD1, BnCard1),
  89.   EV_BN_CLICKED(BUTTON_CARD2, BnCard2),
  90.   EV_BN_CLICKED(BUTTON_CARD3, BnCard3),
  91.   EV_BN_CLICKED(BUTTON_CARD4, BnCard4),
  92.   EV_BN_CLICKED(IDCANCEL     , CmMenuQuit),
  93.   EV_BN_CLICKED(IDOK     , BnFinish),
  94.   EV_COMMAND(MENU_NEW,   CmMenuNew),
  95.   EV_COMMAND(MENU_OLD,   CmMenuOld),
  96.   EV_COMMAND(MENU_SAVE,  CmMenuSave),
  97.   EV_COMMAND(MENU_ABOUT, CmMenuAbout),
  98.   EV_COMMAND(MENU_QUIT,  CmMenuQuit),
  99. //  EV_COMMAND(MENU_EDITCOPY, CmMenuEditCopy),
  100.   EV_COMMAND(MENU_PREFSBET,CmMenuPrefsBet),
  101.   EV_COMMAND(MENU_PREFSHAND,CmMenuPrefsHand),
  102.   EV_COMMAND(MENU_HELPHELP,CmMenuHelp),
  103.   EV_COMMAND(MENU_HELPABOUT, CmMenuAbout),
  104. END_RESPONSE_TABLE;
  105.  
  106. //---------------------------------------------------------------------------
  107. class TPokerApp : public TApplication
  108. {
  109. public:
  110.   TPokerApp(const char *title) : TApplication(title) {}
  111.   void InitMainWindow() {
  112.     TDecoratedFrame *fw=new TDecoratedFrame(0,Name,
  113.                         new TPokerDialog(0,DIALOG_POKER));
  114.     fw->SetFlag(wfShrinkToClient);
  115.     fw->AssignMenu(MENU_POKER);
  116.     // fw->SetIcon(this, ICON_POKERICON);
  117.     // fw->SetIconSm(this, ICON_POKERICON);
  118.     SetMainWindow(fw);
  119.   }
  120. };
  121.  
  122. /********************* Pääohjelma ******************************************/
  123. int OwlMain(int ,char far * [])
  124. {
  125.   return TPokerApp("Poker").Run();
  126. }
  127.  
  128.